<template>
  <div ref="jsmindContainer"></div>
</template>

<script>

// import jsMind from 'jsmind/es6/jsmind.js'
import 'jsmind/style/jsmind.css'
import jsMind from 'jsmind/js-legacy/jsmind.js'


export default {
  name: 'MyComponent',
  data() {
    return {
      mind: null  // jsMind实例
    }
  },
  mounted() {
    const options = {
      container: this.$refs.jsmindContainer,  // 挂载点
      editable: true  // 是否可编辑
    }
    const mind = new jsMind(options)  // 创建jsMind实例
    const data = {  // 思维导图数据
      "meta": {
        "name": "example",
        "author": "hizzgdev@163.com",
        "version": "0.2"
      },
      "format": "node_array",
      "data": [
        {"id":"root","isroot":true,"topic":"jsMind"},
        {"id":"sub1","parentid":"root","topic":"sub1","direction":"left"},
        {"id":"sub2","parentid":"root","topic":"sub2","direction":"right"},
        {"id":"sub3","parentid":"root","topic":"sub3","direction":"right"}
      ]
    }
    mind.show(data)  // 绘制思维导图
    this.mind = mind  // 保存jsMind实例
  }
}

</script>

<style scoped></style>